﻿<?php
include("shuTest.php");
include("Util.php");
$tttt=new UTF8Util();
$T=new TrieTree();
$f= @fopen("1.txt","r");
while (!feof($f)){//读取敏感词
	$line = fgets($f);
	$str=explode('=',$line);
	 $encode=mb_detect_encoding($str[0],array("ASCII","GB2312","GBK","UTF-8")); 
		$str11=mb_convert_encoding($str[0], "utf-8", $encode);
	$T->insert($str11);
	}
	
	
	  $testText=$_POST["content"];
	
	   $delectHuanheng = preg_replace('/\r|\n/', '', $testText);//消去换行符
	//echo $delectHuanheng = str_replace(array("/r/n", "/r", "/n"," "), "", $testText); 
	 $receiveCode=mb_detect_encoding($delectHuanheng,array("GB2312","GBK","UTF-8","ASCII")); 
	if( !in_array($receiveCode,array("GB2312","GBK","UTF-8","ASCII")))
		 $check=mb_convert_encoding($delectHuanheng, "utf-8", "utf-8");
	else	
		$check=mb_convert_encoding($delectHuanheng, "utf-8", $receiveCode);
	echo $T->contain($check,1);
	
	
?>